<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>信加个人信用报告记录</title>
    <style type="text/css">
        .searchArea .fieldBox .label{width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">信用报告ID</div>
                    <div class="field">
                        <input name="id" id="id1" type="text" class="ui-textbox" value="">
                    </div>
                </div>
				<div class="fieldBox">
                    <div class="label">客户姓名</div>
                    <div class="field">
                        <input name="name" id="name1" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">手机号码</div>
                    <div class="field">
                        <input name="mobile" id="mobile1" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">身份证号</div>
                    <div class="field">
                        <input name="certno" id="certno" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round"></i>清空</span>
                </div>
            </div>
        </form>
    </div>

    <div id="ligergrid1" class="sq-grid"></div>
</div>
<!-- 修改弹出框 -->
<div id="change_Html" style="display:none">
    <form id="change_form">
        <div class="fieldset1 tabel_col tabel_col_1 clearFix">
        	<div class="fieldBox col_100">
                <div class="label">客户姓名</div>
                <div class="field">
                    <input name="name" id="name" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">住宅电话</div>
                <div class="field">
                    <input name="hometelephoneno" id="hometelephoneno" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">手机号码</div>
                <div class="field">
                    <input name="moblie" id="moblie" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">单位电话</div>
                <div class="field">
                    <input name="officetelephoneno" id="officetelephoneno" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">通讯地址</div>
                <div class="field">
                    <input name="postaddress" id="postaddress" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">工作单位</div>
                <div class="field">
                    <input name="employer" id="employer" type="text" class="ui-textbox" value="">
                </div>
            </div>
        </div>
        <div class="btnsBox">
            <span id="saveChangeNew_Btn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_10"></i>保存</span>
        </div>
    </form>
</div>
<script type="text/javascript">
    var grid = null, callback=null;
    var addId = {
    		id:null,
    }
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/riskctrl/xjnpReport/initList.do',
            //delayLoad:true,
            method: 'get',
            columns: [
                {display: '报告编号ID', name: 'id', minWidth: 130, align: 'center', enabledSort: false},
                {display: '被查询者姓名', name: 'name', minWidth: 130, align: 'center', enabledSort: false},
                {display: '出生日期', name: 'birthday', minWidth: 130, align: 'center', enabledSort: false},
                {display: '学位', name: 'edudegree', minWidth: 130, align: 'center', enabledSort: false},
                {display: '学历', name: 'edulevel', minWidth: 130, align: 'center', enabledSort: false},
                {display: '性别', name: 'gender', minWidth: 130, align: 'center', enabledSort: false},
                {display: '住宅电话', name: 'hometelephoneno', minWidth: 130, align: 'center', enabledSort: false},
                {display: '婚姻状况', name: 'maritalstate', minWidth: 130, align: 'center', enabledSort: false},
                {display: '手机号码', name: 'mobile', minWidth: 130, align: 'center', enabledSort: false},
                {display: '单位电话', name: 'officetelephoneno', minWidth: 130, align: 'center', enabledSort: false},
                {display: '被查询者证件号码', name: 'certno', minWidth: 130, align: 'center', enabledSort: false},
                {display: '被查询者证件类型', name: 'certtype', minWidth: 130, align: 'center', enabledSort: false},
                {display: '通讯地址', name: 'postaddress', minWidth: 130, align: 'center', enabledSort: false},
                {display: '户籍地址', name: 'registeredaddress', minWidth: 130, align: 'center', enabledSort: false},
                {display: '工作单位', name: 'employer', minWidth: 130, align: 'center', enabledSort: false},
                {display: '配偶信息_姓名', name: 'spousename', minWidth: 130, align: 'center', enabledSort: false},
                {display: '配偶信息_证件号码', name: 'spousecertno', minWidth: 130, align: 'center', enabledSort: false},
                {display: '配偶信息_证件类型', name: 'spousecerttype', minWidth: 130, align: 'center', enabledSort: false},
                {display: '配偶信息_联系电话', name: 'telephoneno', minWidth: 130, align: 'center', enabledSort: false},
                {display: '本人声明数目', name: 'announcecount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '异议标注数目', name: 'dissentcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '首笔贷款发放月份', name: 'flcardonmm', minWidth: 130, align: 'center', enabledSort: false},
                {display: '首张贷记卡发卡月份', name: 'floanonmm', minWidth: 130, align: 'center', enabledSort: false},
                {display: '首张准贷记卡发卡月份', name: 'fstdlcardonmm', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷记卡账户数', name: 'loancardcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '其他贷款笔数', name: 'otherloancount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '个人商用房贷款笔数', name: 'perbusshoulcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '个人住房贷款笔数', name: 'perhoulcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '准贷记卡账户数', name: 'stdlcardcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '保证人代偿汇总余额', name: 'assrepaysumbalance', minWidth: 130, align: 'center', enabledSort: false},
                {display: '保证人代偿汇总笔数', name: 'assrepaysumcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '资产处置信息汇总余额', name: 'assetdispsumbalance', minWidth: 130, align: 'center', enabledSort: false},
                {display: '资产处置信息汇总笔数', name: 'assetdispsumcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '呆帐信息汇总余额', name: 'fellbackdebtsumbalance', minWidth: 130, align: 'center', enabledSort: false},
                {display: '呆帐信息汇总笔数', name: 'fellbackdebtsumcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷款逾期笔数/账户数', name: 'loansumcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷款逾期单月最高逾期总额/单月最高透支总额', name: 'loansumhoamtpermon', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷款逾期最长逾期月数/最长透支月数', name: 'loansummaxduration', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷款逾期月份数', name: 'loansummonths', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷记卡逾期笔数/账户数', name: 'loancardsumcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷记卡逾期单月最高逾期总额/单月最高透支总额', name: 'loancardsumhoamtpermon', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷记卡逾期最长逾期月数/最长透支月数', name: 'loancardsummaxduration', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷记卡逾期月份数', name: 'loancardsummonths', minWidth: 130, align: 'center', enabledSort: false},
                {display: '准贷记卡60天以上透支笔数/账户数', name: 'stanloancardsumcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '准贷记卡60天以上透支月份数', name: 'stanloancardsummonths', minWidth: 130, align: 'center', enabledSort: false},
                {display: '准贷记卡60天以上透支单月最高逾期总额/单月最高透支总额', name: 'stdlcardshoamtpermon', minWidth: 130, align: 'center', enabledSort: false},
                {display: '准贷记卡60天以上透支最长逾期月数/最长透支月数', name: 'stdlcardsmaxdu', minWidth: 130, align: 'center', enabledSort: false},
                {display: '产品版式', name: 'format', minWidth: 130, align: 'center', enabledSort: false},
                {display: '产品版本', name: 'formatversion', minWidth: 130, align: 'center', enabledSort: false},
                {display: '产品种类', name: 'producttype', minWidth: 130, align: 'center', enabledSort: false},
                {display: '查询机构', name: 'queryorg', minWidth: 130, align: 'center', enabledSort: false},
                {display: '查询原因', name: 'queryreason', minWidth: 130, align: 'center', enabledSort: false},
                {display: '查询操作员', name: 'queryresultcue', minWidth: 130, align: 'center', enabledSort: false},
                {display: '查询结果提示', name: 'usercode', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近1个月内贷款审批次数', name: 'lastmmqueorgloans', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近1个月内信用卡审批次数', name: 'lastmqueorglcards', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近1个月内的查询次数_信用卡审批次数', name: 'lastmquerelcards', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近1个月内的查询次数_贷款审批次数', name: 'lastmquereloans', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近1个月内的查询次数_本人查询次数', name: 'lastmqueremyselfs', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近2年内的查询次数_特约商户实名审查', name: 'tyqueregquerspecmerchquers', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近2年内的查询次数_担保资格査审', name: 'tyqueregquers', minWidth: 130, align: 'center', enabledSort: false},
                {display: '最近2年内的查询次数_贷后管理次数', name: 'tyquerelmentaftens', minWidth: 130, align: 'center', enabledSort: false},
                {display: '查询请求时间', name: 'querytime', minWidth: 130, align: 'center', enabledSort: false},
                {display: '报告时间', name: 'reportcreatetime', minWidth: 130, align: 'center', enabledSort: false},
                {display: '报告编号', name: 'reportsn', minWidth: 130, align: 'center', enabledSort: false},
                {display: '数字解读', name: 'score', minWidth: 130, align: 'center', enabledSort: false},
                {display: '相对位置', name: 'scorelevel', minWidth: 130, align: 'center', enabledSort: false},
                {display: '担保金额', name: 'amount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '担保本金余额', name: 'balance', minWidth: 130, align: 'center', enabledSort: false},
                {display: '担保笔数', name: 'count', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡笔数/账户数', name: 'undestloancardaccountcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡笔数/账户数', name: 'undestloancardbalance', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡合同金额/授信总额', name: 'undestloancardcreditlimit', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡贷款法人机构数/发卡法人机构数', name: 'unlcardfincorpcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡贷款机构数/发卡机构数', name: 'unlcardfinorgcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡最近6个月平均应还款/最近6个月平均使用额度/最近6个月平均透支余额', name: 'unlcardlast6museavgamt', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡单家行最高授信额度', name: 'unlcardmaxcrelimperorg', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡单家行最低授信额度', name: 'unlcardmincrelimperorg', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户贷记卡已用额度/透支余额', name: 'unlcardusecrelim', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡余额', name: 'undestrstanloancardbalance', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡笔数/账户数', name: 'unstdlcardaccount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡合同金额/授信总额', name: 'unstdlcardcrelim', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡贷款法人机构数/发卡法人机构数', name: 'unstdlcardfincorpcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡贷款机构数/发卡机构数', name: 'unstdlcardfinorgcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡最近6个月平均应还款/最近6个月平均使用额度/最近6个月平均透支余额', name: 'unstdlcardlast6museavgamt', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡单家行最高授信额度', name: 'unstdlcardmaxcrlimperorg', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡单家行最低授信额度', name: 'unstdlcardmincrlimperorg', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未销户准贷记卡已用额度/透支余额', name: 'unstdlcardusecrlim', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未结清贷款信息汇总_近6个月平均应还款/最近6个月平均使用额度/最近6个月平均透支余额', name: 'unloanlast6museavgamt', minWidth: 130, align: 'center', enabledSort: false},
                {display: '单家行最高授信额度', name: 'unloanmaxcrelimperorg', minWidth: 130, align: 'center', enabledSort: false},
                {display: '单家行最低授信额度', name: 'unloanmincrelimperorg', minWidth: 130, align: 'center', enabledSort: false},
                {display: '笔数/账户数', name: 'unpailoanaccountcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '未结清贷款信息汇总_余额', name: 'unpailoanbalance', minWidth: 130, align: 'center', enabledSort: false},
                {display: '合同金额/授信总额', name: 'unpailoancreditlimit', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷款法人机构数/发卡法人机构数', name: 'unpailoanfinancecorpcoun', minWidth: 130, align: 'center', enabledSort: false},
                {display: '贷款机构数/发卡机构数', name: 'unpailoanfinanceorgcount', minWidth: 130, align: 'center', enabledSort: false},
                {display: '已用额度/透支余额', name: 'unpailoanusedcreditlimit', minWidth: 130, align: 'center', enabledSort: false},
                
                {
                    display: '操作', name: '', minWidth: 150, align: 'left', enabledSort: false,
                    render: function (rowdata, rowindex, value){
                    	var h='<a class="sq-button-hasicon" href="javascript:toMfrModify(';
	            		h+="'"+rowdata.id+"'";
	                    h+=')"><i class="sqBtnIco_4"></i>修改</a>';
	            		var d='<a class="sq-button-hasicon" href="javascript:deleteRecord(';
		            		d+="'"+rowdata.id+"'";
		                    d+=')"><i class="sqBtnIco_7"></i>删除</a>';
	                	return h + d;
                    }
                }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            rownumbers:true,
            frozen: false,
            allowUnSelectRow: true,
            alternatingRow: false,
            onBeforeShowData: function ()
            {
                //var grid = this;
                //grid.collapsedRows = [];
            }
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });
        
        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "*Cd": " "
            });
        });
        callback = function () {
            grid.reload();
        };
        $("#saveChangeNew_Btn").click(function(event) {
        	var form = liger.get("change_form");
            if (!form.valid()) {
            	$.ligerDialog.SQalert({content:LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var data = form.getData();
            $.extend(true, data, addId);
    		var wait_dialog;
    		$.ligerDialog.hide();
    		$.ajax({
    			type: 'post',
    			dataType:'json',
    			data:data,
    			url: '<%=path%>/riskctrl/xjnpReport/modify.do',
    			beforeSend:function(){
    				wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
    			},
    			success:function(msg){
    				wait_dialog.close();
    				if(msg.success == 1){
    					$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
    					grid.reload();
    				 }else{
    					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
    				 }
    			}
    		});
        });
    });
    function deleteRecord(id){
  	  if(!id)return;
  	  var isDel = 1;
  	  $.ajax({
  		  type:'POST',
  		  dataType:'json',
  		  data:{id:id,isDel:isDel},
  		  url:'<%=path%>/riskctrl/xjnpReport/modify.do',
  			beforeSend : function() {
  				wait_dialog = $.ligerDialog.SQalert({
  					content : LogUtils.LOG_CMM_DATA_LOADING,
  					SQ_type : "waitting"
  				});
  			},
  			success : function(msg) {
  				wait_dialog.close();
  				if (msg.success == 1) {
  					$.ligerDialog.SQalert({
  						content : msg.info,
  						SQ_type : "success"
  					});
  					grid.reload();
  				} else {
  					$.ligerDialog.SQalert({
  						content : msg.info,
  						SQ_type : "error"
  					});
  				}
  			}
  		});
  	}
    function toMfrModify(id){
		if(!id)return;
		$.ajax({
			type: 'get',
			dataType:'json',
			data:{id:id},
			url: '<%=path%>/riskctrl/xjnpReport/getById.do',
			success:function(msg){
				if(msg.success == 1){
					openChange();//弹出修改框
					setData(msg.data);//设置数据
					addId.id = id;
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	}
	function openChange(){
		$.ligerDialog.open({
	        width: 400,
	        top: 100,
	        title : '修改信息',
	        target: $("#change_Html"),
	        onHideDialog: function () {
	            clearLigerForm("change_form");
	        }
	    });
		$("#change_form").ligerForm({validate: true});
	}
	function setData(data){
		var form = new liger.get("change_form");
		form.setData({
			id:data.id,
			name:data.name,
			hometelephoneno:data.hometelephoneno,
			moblie:data.moblie,
			officetelephoneno:data.officetelephoneno,
			postaddress:data.postaddress,
			employer:data.employer
		});
	}
</script>

</body>
</html>
